import { BaseModel } from '../BaseModel';

export class UserClassList extends BaseModel {
  constructor() {
    super();
    this.symbolName = 'UserClassList';
    this.tableName = 't_user_teaching_progress';
    this.id = ''; //唯一ID
    this.userId = ''; //用户ID
    this.bookId = ''; //书本ID
    this.currentLesson = ''; //当前教学所在章节
    this.publishName = ''; //教材版本名称
    this.className = ''; //班级名称
    this.isActive = 0; //是否为选中班级
    this.reverse1 = ''; //备忘录
    this.reverse2 = ''; //备用字段2
    this.reverse3 = ''; //备用字段3
  }
  dbMapper() {
    return {
      id: 'id',
      userId: 'user_id',
      bookId: 'book_id',
      currentLesson: 'current_lesson',
      publishName: 'publish_name',
      className: 'class_name',
      isActive: 'is_active',
      reverse1: 'reverse1',
      reverse2: 'reverse2',
      reverse3: 'reverse3',
    };
  }
  /**
   * 输出转换
   * @param obj
   * @returns {Book}
   */
  mappingModel(obj) {
    let userClassList = new UserClassList();
    userClassList.id = obj.id ? obj.id : '';
    userClassList.userId = obj.user_id ? obj.user_id : '';
    userClassList.bookId = obj.book_id ? obj.book_id : '';
    userClassList.currentLesson = obj.current_lesson ? obj.current_lesson : '';
    userClassList.publishName = obj.publish_name ? obj.publish_name : '';
    userClassList.className = obj.class_name ? obj.class_name : '';
    userClassList.isActive = obj.is_active ? obj.is_active : '';
    userClassList.reverse1 = obj.reverse1 ? obj.reverse1 : '';
    userClassList.reverse2 = obj.reverse2 ? obj.reverse2 : '';
    userClassList.reverse3 = obj.reverse3 ? obj.reverse3 : '';
    return userClassList;
  }
}
